<template>
  <div>
    <h1>姓名:{{ name }}</h1>
    <h1>年龄：{{ age }}</h1>
    <button @click="sendStudentName">点击把学生名字给School组件</button>
  </div>
</template>

<script>
export default {
  name: 'School',
  data() {
    return {
      name: '张无忌',
      age: 18,
    }
  },
  methods: {
    sendStudentName() {
      this.$bus.$emit('demo', this.name)
    },
  },
}
</script>

<style></style>
